<?php
/*
 * Created on 24 janv. 2009
 * Created by Ludovic Reenaers
 * lreenaers@hotmail.com
 */
 class Langue{
 	private $id;
 	private $abr;#3
 	private $full_text;#20
 	private $available;#boolean
 	function __construct($id) {
 		if (is_int($id)){
 			if($id > 0){
				$this->id=$id;
 			}else{
 				throw new Exception("id must be superior to 0");
 			}
 		}else{
 			throw new Exception("id must be integer");
 		}
	}
	function setAbr($abr){
		if(is_string($abr)){
			
			if(str_replace(" ","",$abr) != ""){
				if(strlen($abr) > 0 and strlen($abr) < 4){
					$this->abr=$abr;
				}else{
					throw new Exception("abr length could be 1 to 3 char");
				}
			}else{
				throw new Exception("abr could not be empty string");	
			}
		}else{
			throw new Exception("abr must be a string");
		}
	}
	function getAbr(){
		return $this->abr;
	}
	function getId(){
		return $this->id;
	}
	function setFullText($fullText){
		if(is_string($fullText)){
			if(str_replace(" ","",$fullText) != ""){
				if (strlen($fullText) > 0 and strlen($fullText) < 21){
					$this->full_text=$fullText;
				}else{
					throw new Exception("fulltext length could be 1 to 20 char");
				}
			}else{
				throw new Exception("fulltext could not be an empty string");	
			}
		}else{
			throw new Exception("fulltext must be a string");
		}
	}
	function setAvailable($available_bool){
		if(is_bool($available_bool)){
			$this->available=$available_bool;
		}else{
			throw new Exception("available must be a boolean");
		}
	}
	function getAvailable(){
		return $this->available;
	}
	function getFullText(){
		return $this->full_text;
	}
 }
?>
